package com.shijun.im.application;

import android.app.Application;
import android.content.Intent;
import android.util.Log;

import com.alibaba.sdk.android.media.WantuService;
import com.shijun.im.service.IMService;

/**
 * Created by zhushijun on 2017/9/25 0025.
 */

public class MyAppLication extends Application {
    private WantuService wantuService;
    private IMService imService;
    private static MyAppLication myAppLication;
    private String packageName = "com.shijun.im";

    public static MyAppLication getMyAppLication(){
        return myAppLication;
    }

    public String getPackageName(){
        return packageName;
    }

    @Override
    public void onCreate() {
        super.onCreate();

        myAppLication = (MyAppLication)this.getApplicationContext();
        WantuService.enableHttpDNS(); // 可选。为了避免域名劫持，建议开发者启用HttpDNS
        WantuService.enableLog(); //在调试时，可以打开日志。正式上线前可以关闭

        wantuService = WantuService.getInstance();
        wantuService.asyncInit(this);


        Intent startIntent = new Intent(this, IMService.class);
        startService(startIntent);
    }

    public WantuService getWantuService(){
        return this.wantuService;
    }

    public void setIMService(IMService service){
        this.imService = service;
        Log.i("TAG","设置服务");
    }

    public IMService getIMService(){
        return imService;
    }

}
